﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My.Resources;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_DMLienHeDoiTuong : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("CKTruongDaiDien")]
        private CheckBox _CKTruongDaiDien;
        [AccessedThroughProperty("CmdCancel")]
        private Button _CmdCancel;
        [AccessedThroughProperty("CmdOK")]
        private Button _CmdOK;
        [AccessedThroughProperty("GroupBox4")]
        private GroupBox _GroupBox4;
        [AccessedThroughProperty("Label10")]
        private Label _Label10;
        [AccessedThroughProperty("Label12")]
        private Label _Label12;
        [AccessedThroughProperty("Label17")]
        private Label _Label17;
        [AccessedThroughProperty("Label4")]
        private Label _Label4;
        [AccessedThroughProperty("Label9")]
        private Label _Label9;
        [AccessedThroughProperty("TxtChucdanh")]
        private TextBox _TxtChucdanh;
        [AccessedThroughProperty("TxtDiaChi")]
        private TextBox _TxtDiaChi;
        [AccessedThroughProperty("TxtDienThoai")]
        private TextBox _TxtDienThoai;
        [AccessedThroughProperty("TxtEmail")]
        private TextBox _TxtEmail;
        [AccessedThroughProperty("TxtTen")]
        private TextBox _TxtTen;
        private DataView cFrmData;
        public string cFrmKhoa;
        public string cFrmKhoaDoiTuong;
        private string cFrmKhoaOld;
        private string cFrmTask;
        private IContainer components;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mEnableControl;
        private clsDMLienHeDoiTuong objLHDT;
        public string pKhoaDoiTuong;

        public Frm_DMLienHeDoiTuong()
        {
            base.FormClosing += new FormClosingEventHandler(this.Frm_DMLienHeDoiTuong_FormClosing);
            base.Load += new EventHandler(this.Frm_DMLienHeDoiTuong_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.pKhoaDoiTuong = "";
            this.cFrmKhoaOld = "";
            this.cFrmKhoa = "";
            this.cFrmKhoaDoiTuong = "";
            this.cFrmTask = "";
            this.mAllowEdit = true;
            this.mAllowDel = false;
            this.objLHDT = new clsDMLienHeDoiTuong();
            this.InitializeComponent();
        }

        private void ButtonCancle_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void ButtonOK_Click(object sender, EventArgs e)
        {
            if (this.CheckIvalid())
            {
                if (LVYModule.ReturnIfNull(this.cFrmKhoa, "", modGeneral.TypeOfValue.Nothing).ToString().Trim() == "")
                {
                    this.cFrmKhoa = modGeneral.CreatKey("DM_LienHeDoiTuong", 10, "");
                }
                clsDMLienHeDoiTuong objLHDT = this.objLHDT;
                objLHDT.Khoa = this.cFrmKhoa;
                objLHDT.KhoaDoiTuong = this.cFrmKhoaDoiTuong;
                objLHDT.Ten = this.TxtTen.Text;
                objLHDT.DiaChi = this.TxtDiaChi.Text;
                objLHDT.DienThoai = this.TxtDienThoai.Text;
                objLHDT.Email = this.TxtEmail.Text;
                objLHDT.ChucDanh = this.TxtChucdanh.Text;
                if (this.CKTruongDaiDien.CheckState == CheckState.Checked)
                {
                    objLHDT.TruongDaiDien = 1;
                }
                else
                {
                    objLHDT.TruongDaiDien = 0;
                }
                if (objLHDT.Save())
                {
                    objLHDT = null;
                    this.Close();
                }
            }
        }

        public bool CheckIvalid()
        {
            if (this.TxtTen.Text.Trim() == "")
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn phải nhập t\x00ean!", ""));
                this.TxtTen.Focus();
                return false;
            }
            return true;
        }

        private void CmdExit_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        public void EmptyData()
        {
            this.TxtTen.Text = "";
            this.TxtDienThoai.Text = "";
            this.TxtDiaChi.Text = "";
            this.TxtEmail.Text = "";
            this.TxtChucdanh.Text = "";
            this.CKTruongDaiDien.CheckState = CheckState.Unchecked;
        }

        private void Frm_DMLienHeDoiTuong_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.cFrmKhoa = "";
        }

        private void Frm_DMLienHeDoiTuong_Load(object sender, EventArgs e)
        {
            if (LVYModule.ReturnIfNull(this.cFrmKhoa, "", modGeneral.TypeOfValue.Nothing).ToString().Trim() != "")
            {
                this.ShowData(this.cFrmKhoa);
            }
            else
            {
                this.EmptyData();
            }
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_DMLienHeDoiTuong));
            this.Label4 = new Label();
            this.TxtTen = new TextBox();
            this.Label17 = new Label();
            this.CKTruongDaiDien = new CheckBox();
            this.GroupBox4 = new GroupBox();
            this.TxtChucdanh = new TextBox();
            this.TxtEmail = new TextBox();
            this.Label12 = new Label();
            this.TxtDienThoai = new TextBox();
            this.Label10 = new Label();
            this.TxtDiaChi = new TextBox();
            this.Label9 = new Label();
            this.CmdCancel = new Button();
            this.CmdOK = new Button();
            this.GroupBox4.SuspendLayout();
            this.SuspendLayout();
            this.Label4.AutoSize = true;
            Point point = new Point(8, 0x19);
            this.Label4.Location = point;
            this.Label4.Name = "Label4";
            Size size = new Size(0x1a, 13);
            this.Label4.Size = size;
            this.Label4.TabIndex = 0x43;
            this.Label4.Text = "T\x00ean";
            point = new Point(0x65, 0x16);
            this.TxtTen.Location = point;
            this.TxtTen.Name = "TxtTen";
            size = new Size(0x11a, 20);
            this.TxtTen.Size = size;
            this.TxtTen.TabIndex = 1;
            this.Label17.AutoSize = true;
            point = new Point(8, 0x35);
            this.Label17.Location = point;
            this.Label17.Name = "Label17";
            size = new Size(0x3b, 13);
            this.Label17.Size = size;
            this.Label17.TabIndex = 0x54;
            this.Label17.Text = "Chức danh";
            this.CKTruongDaiDien.AutoSize = true;
            point = new Point(0x65, 0xa3);
            this.CKTruongDaiDien.Location = point;
            this.CKTruongDaiDien.Name = "CKTruongDaiDien";
            size = new Size(0x65, 0x11);
            this.CKTruongDaiDien.Size = size;
            this.CKTruongDaiDien.TabIndex = 6;
            this.CKTruongDaiDien.Text = "Trưởng đại diện";
            this.CKTruongDaiDien.UseVisualStyleBackColor = true;
            this.GroupBox4.BackColor = Color.Transparent;
            this.GroupBox4.Controls.Add(this.TxtChucdanh);
            this.GroupBox4.Controls.Add(this.TxtEmail);
            this.GroupBox4.Controls.Add(this.Label12);
            this.GroupBox4.Controls.Add(this.TxtDienThoai);
            this.GroupBox4.Controls.Add(this.Label10);
            this.GroupBox4.Controls.Add(this.TxtDiaChi);
            this.GroupBox4.Controls.Add(this.Label9);
            this.GroupBox4.Controls.Add(this.CKTruongDaiDien);
            this.GroupBox4.Controls.Add(this.Label17);
            this.GroupBox4.Controls.Add(this.TxtTen);
            this.GroupBox4.Controls.Add(this.Label4);
            point = new Point(5, 4);
            this.GroupBox4.Location = point;
            this.GroupBox4.Name = "GroupBox4";
            size = new Size(0x18a, 0xc2);
            this.GroupBox4.Size = size;
            this.GroupBox4.TabIndex = 0x20;
            this.GroupBox4.TabStop = false;
            this.GroupBox4.Text = "Th\x00f4ng tin li\x00ean hệ";
            point = new Point(0x65, 50);
            this.TxtChucdanh.Location = point;
            this.TxtChucdanh.Name = "TxtChucdanh";
            size = new Size(0x11a, 20);
            this.TxtChucdanh.Size = size;
            this.TxtChucdanh.TabIndex = 2;
            point = new Point(0x65, 0x88);
            this.TxtEmail.Location = point;
            this.TxtEmail.Name = "TxtEmail";
            size = new Size(0x11a, 20);
            this.TxtEmail.Size = size;
            this.TxtEmail.TabIndex = 5;
            this.Label12.AutoSize = true;
            point = new Point(8, 0x8b);
            this.Label12.Location = point;
            this.Label12.Name = "Label12";
            size = new Size(0x20, 13);
            this.Label12.Size = size;
            this.Label12.TabIndex = 0x63;
            this.Label12.Text = "Email";
            point = new Point(0x65, 0x6b);
            this.TxtDienThoai.Location = point;
            this.TxtDienThoai.Name = "TxtDienThoai";
            size = new Size(0x75, 20);
            this.TxtDienThoai.Size = size;
            this.TxtDienThoai.TabIndex = 4;
            this.Label10.AutoSize = true;
            point = new Point(8, 110);
            this.Label10.Location = point;
            this.Label10.Name = "Label10";
            size = new Size(0x37, 13);
            this.Label10.Size = size;
            this.Label10.TabIndex = 0x62;
            this.Label10.Text = "Điện thoại";
            point = new Point(0x65, 0x4e);
            this.TxtDiaChi.Location = point;
            this.TxtDiaChi.Name = "TxtDiaChi";
            size = new Size(0x11a, 20);
            this.TxtDiaChi.Size = size;
            this.TxtDiaChi.TabIndex = 3;
            this.Label9.AutoSize = true;
            point = new Point(8, 0x51);
            this.Label9.Location = point;
            this.Label9.Name = "Label9";
            size = new Size(40, 13);
            this.Label9.Size = size;
            this.Label9.TabIndex = 0x61;
            this.Label9.Text = "Địa chỉ";
            this.CmdCancel.DialogResult = DialogResult.Cancel;
            this.CmdCancel.Image = (Image) manager.GetObject("CmdCancel.Image");
            this.CmdCancel.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(320, 0xc9);
            this.CmdCancel.Location = point;
            this.CmdCancel.Name = "CmdCancel";
            size = new Size(0x4f, 0x18);
            this.CmdCancel.Size = size;
            this.CmdCancel.TabIndex = 8;
            this.CmdCancel.Text = "&Tho\x00e1t";
            this.CmdCancel.UseVisualStyleBackColor = true;
            this.CmdOK.Image = (Image) manager.GetObject("CmdOK.Image");
            this.CmdOK.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0xed, 0xc9);
            this.CmdOK.Location = point;
            this.CmdOK.Name = "CmdOK";
            size = new Size(0x4e, 0x18);
            this.CmdOK.Size = size;
            this.CmdOK.TabIndex = 7;
            this.CmdOK.Text = "&Chọn";
            this.CmdOK.UseVisualStyleBackColor = true;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            this.BackgroundImage = ACCOUNTING.My.Resources.Resources.background;
            size = new Size(0x195, 230);
            this.ClientSize = size;
            this.ControlBox = false;
            this.Controls.Add(this.CmdCancel);
            this.Controls.Add(this.CmdOK);
            this.Controls.Add(this.GroupBox4);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.Name = "Frm_DMLienHeDoiTuong";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "LIEN HE KHACH HANG";
            this.GroupBox4.ResumeLayout(false);
            this.GroupBox4.PerformLayout();
            this.ResumeLayout(false);
        }

        public void ShowData(string pKhoa)
        {
            clsDMLienHeDoiTuong objLHDT = this.objLHDT;
            objLHDT.Load(pKhoa);
            this.cFrmKhoa = objLHDT.Khoa;
            this.TxtTen.Text = objLHDT.Ten.Trim();
            this.TxtDienThoai.Text = objLHDT.DienThoai.Trim();
            this.TxtDiaChi.Text = objLHDT.DiaChi.Trim();
            this.TxtEmail.Text = objLHDT.Email.Trim();
            this.TxtChucdanh.Text = objLHDT.ChucDanh.Trim();
            if (objLHDT.TruongDaiDien == 1)
            {
                this.CKTruongDaiDien.CheckState = CheckState.Checked;
            }
            else
            {
                this.CKTruongDaiDien.CheckState = CheckState.Unchecked;
            }
            objLHDT = null;
        }

        internal virtual CheckBox CKTruongDaiDien
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CKTruongDaiDien;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CKTruongDaiDien = value;
            }
        }

        internal virtual Button CmdCancel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdCancel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.ButtonCancle_Click);
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click -= handler;
                }
                this._CmdCancel = value;
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click += handler;
                }
            }
        }

        internal virtual Button CmdOK
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdOK;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.ButtonOK_Click);
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click -= handler;
                }
                this._CmdOK = value;
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click += handler;
                }
            }
        }

        public bool EnableControl
        {
            get
            {
                return this.mEnableControl;
            }
            set
            {
                this.mEnableControl = value;
                this.TxtChucdanh.ReadOnly = !value;
                this.TxtTen.ReadOnly = !value;
                this.TxtDiaChi.ReadOnly = !value;
                this.TxtDienThoai.ReadOnly = !value;
                this.TxtEmail.ReadOnly = !value;
                this.CKTruongDaiDien.Enabled = value;
                this.CmdOK.Enabled = value;
                this.CmdCancel.Enabled = value;
            }
        }

        internal virtual GroupBox GroupBox4
        {
            [DebuggerNonUserCode]
            get
            {
                return this._GroupBox4;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._GroupBox4 = value;
            }
        }

        internal virtual Label Label10
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label10;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label10 = value;
            }
        }

        internal virtual Label Label12
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label12;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label12 = value;
            }
        }

        internal virtual Label Label17
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label17;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label17 = value;
            }
        }

        internal virtual Label Label4
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label4;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label4 = value;
            }
        }

        internal virtual Label Label9
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label9;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label9 = value;
            }
        }

        internal virtual TextBox TxtChucdanh
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtChucdanh;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtChucdanh = value;
            }
        }

        internal virtual TextBox TxtDiaChi
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtDiaChi;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtDiaChi = value;
            }
        }

        internal virtual TextBox TxtDienThoai
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtDienThoai;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtDienThoai = value;
            }
        }

        internal virtual TextBox TxtEmail
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtEmail;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtEmail = value;
            }
        }

        internal virtual TextBox TxtTen
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtTen;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtTen = value;
            }
        }
    }
}

